package com.ruoyi.sale.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sale.mapper.SaleOrderProductMapper;
import com.ruoyi.sale.domain.SaleOrderProduct;
import com.ruoyi.sale.service.ISaleOrderProductService;

/**
 * 销售订单产品Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-10-30
 */
@Service
public class SaleOrderProductServiceImpl implements ISaleOrderProductService 
{
    @Autowired
    private SaleOrderProductMapper saleOrderProductMapper;

    /**
     * 查询销售订单产品
     * 
     * @param id 销售订单产品主键
     * @return 销售订单产品
     */
    @Override
    public SaleOrderProduct selectSaleOrderProductByOrderId(Long id)
    {
        return saleOrderProductMapper.selectSaleOrderProductByOrderId(id);
    }

    /**
     * 查询销售订单产品列表
     * 
     * @param saleOrderProduct 销售订单产品
     * @return 销售订单产品
     */
    @Override
    public List<SaleOrderProduct> selectSaleOrderProductList(SaleOrderProduct saleOrderProduct)
    {
        return saleOrderProductMapper.selectSaleOrderProductList(saleOrderProduct);
    }

    /**
     * 新增销售订单产品
     * 
     * @param saleOrderProduct 销售订单产品
     * @return 结果
     */
    @Override
    public int insertSaleOrderProduct(SaleOrderProduct saleOrderProduct)
    {
        saleOrderProduct.setCreateTime(DateUtils.getNowDate());
        return saleOrderProductMapper.insertSaleOrderProduct(saleOrderProduct);
    }

    /**
     * 修改销售订单产品
     * 
     * @param saleOrderProduct 销售订单产品
     * @return 结果
     */
    @Override
    public int updateSaleOrderProduct(SaleOrderProduct saleOrderProduct)
    {
        saleOrderProduct.setUpdateTime(DateUtils.getNowDate());
        return saleOrderProductMapper.updateSaleOrderProduct(saleOrderProduct);
    }

    /**
     * 批量删除销售订单产品
     * 
     * @param ids 需要删除的销售订单产品主键
     * @return 结果
     */
    @Override
    public int deleteSaleOrderProductByIds(Long[] ids)
    {
        return saleOrderProductMapper.deleteSaleOrderProductByIds(ids);
    }

    /**
     * 删除销售订单产品信息
     * 
     * @param id 销售订单产品主键
     * @return 结果
     */
    @Override
    public int deleteSaleOrderProductBySaleId(Long id)
    {
        return saleOrderProductMapper.deleteSaleOrderProductBySaleId(id);
    }
}
